package com.gujia.rabbitmq.topic;

import com.gujia.rabbitmq.util.ConnectionUtils;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;

public class Sender {

    private static final String EXCHANGE_NAME="test_exchange_topic";
    private static final String QUEUE_NAME="test_queue_direct_1";
    public static void main(String[] args) throws Exception{
        Connection connection = ConnectionUtils.getConnction();
        Channel channel = connection.createChannel();

        channel.exchangeDeclare(EXCHANGE_NAME,"topic");

        String msgString="商品";
        channel.basicPublish(EXCHANGE_NAME,"GOODS.ADD",null,msgString.getBytes());

        System.out.println("send:"+msgString);

        channel.close();
        connection.close();
    }
}
